{% extends 'main.html' %}
{% load i18n %}
{% block content %}
<div class="detail">
  <div class="post">
    <h1>{{file.displayName}}</h1>
		<h5>
        {{file.createTime|date:"Y-m-d H:i:s"}}&nbsp;&nbsp;
        {% trans "Category" %}:<a href="/main/albums/?category={{file.jumCategory.key.id}}">{{file.jumCategory.name}}</a>
    </h5>

    <p>{{file.describe}}</p>
    <p> <a href="/main/getPicture/?id={{file.key.id}}" target="_blank">
      <img src="/main/getPicture/?id={{file.key.id}}" border="0" alt="{{file.name}}" width="{{file.displayWidth}}" height="{{file.displayHeight}}" />
      </a></p>
    <h4>
            <a href="/main/getPicture/?id={{file.key.id}}" target="_blank">
            {% trans 'Download' %}
            </a>
    </h4>
  </div>
  
  <div class="comments">
    <h3>{% trans "Comment" %}</h3>
    {% for comment in file.picturecomment_set %}
      <div class="comment">
        <h4>
              {{comment.name|escape}}({{comment.createTime|date:"Y-m-d H:i:s"}}):
        </h4>
        <p>{{comment.content|escape|linebreaks}}</p>
        {% if admin %}
          <h4>
            <a href="/admin/deletePictureComment/?id={{comment.key.id}}&pid={{file.key.id}}" onClick="return confirm('{% trans "Are you sure?" %}')">
                    {% trans 'Delete' %}
            </a>
          </h4>
        {% endif %}
      </div>
    {% endfor %}
  </div>
  <div class="addcomment"
    <h4>{% trans "New Comment" %}</h4>
	   
    <form name="comment" action="/client/addPictureComment/" method="post">
      <input type="hidden" name="id" value="{{file.key.id}}" />
      <p>
        {% trans "User Name" %}:
        <input name="name" type='text' size="40" />
	    </p>
      <p>	    {% trans "Address" %}:
        <input name="address" type='text' size="40" />
	    </p>
      <p>{% trans "Comment" %}:</p>
	    <p><textarea name="content" rows="10" cols="52" ></textarea></p>
	    <p class="subbutton">
        <input type='submit' value='{% trans "OK" %}' />
      </p>
    </form>
  </div>
</div>
{% endblock content %}